from django.contrib import admin

# Register your models here.
from .models import Category,Post,Tag


class PostAdmin(admin.ModelAdmin):
    list_display = ['title','created_time','modified_time','category','author']
    field = ['title','body','excerpt','category','tags']   #不在field范围内的默认可以不填写！


    def save_model(self,request,obj,form,change):
        obj.author = request.user
        super().save_model(request,obj,form,change)

admin.site.register(Post,PostAdmin)
admin.site.register(Category)
admin.site.register(Tag)
